<div class="toolbox divider nobr">
	<input type="button" id="role_brw" class="button" value="浏览" />
	<input type="button" id="role_add" class="button" value="添加" />
	<input type="button" id="role_mod" class="button" value="修改" />
	<input type="button" id="role_del" class="button" value="删除" />
	<input type="button" id="role_auth" class="button" value="权限" />
</div>

<script type="text/javascript">
	var mainPanel = 'mainPanel';
	var item_value ,del_ids;
	
	$('role_brw').addEvent('click', function(e){
		MUI.updateContent({
			'element':  $(mainPanel),
			'url':      '/mochaui/data/roles.html',
			//'onContentLoaded' : function(){ roles.findList(1);}
		});
	});
	
	$('role_add').addEvent('click', function(e){
		MUI.updateContent({
			'element':  $(mainPanel),
			'url':      '/mochaui/data/role.add.html'
		});
	});
	
	$('role_mod').addEvent('click', function(e){
		if(roles.checkIds()==1){
			var item = roles.findFirstIds();
			item_value = item.value;		
			MUI.updateContent({
				'element':  $(mainPanel),
				'url':      '/mochaui/data/role.mod.html'
			});
		}else{
			MUI.notification('<font color=red>错误：</font>只能选择一条记录进行修改！');
			return;
		}
	});
	
	$('role_del').addEvent('click', function(e){
		if(roles.checkIds()>=1){
			var confirm = confirmWindow('删除角色','确定要删除选中的角色？<input id="comfirm" type="button" value="确定" ><input id="cancel" type="button" value="取消" >');
			$('comfirm').addEvent('click',function(e){
				confirm.close();
				var itemarr = roles.findIds();
				del_ids = roles.arrCbToStr(itemarr);	
				//alert(del_ids);
				MUI.updateContent({
					'element':  $(mainPanel),
					'url':      '/mochaui/data/role.del.html'
				});
			});
			$('cancel').addEvent('click',function(e){
				confirm.close();
			});
		}else{
			MUI.notification('<font color=red>错误：</font>至少选择一条记录！');
			return;
		}
	});
	
	$('role_auth').addEvent('click', function(e){
		if(roles.checkIds()==1){
			var item = roles.findFirstIds();
			item_value = item.value;		
			new MUI.Column({
				container: mainPanel,
				id: 'authTreeCol',
				placement: 'left',
				width: 200,
				resizeLimit: [100, 300]
			});
			
			new MUI.Column({
				container: mainPanel,
				id: 'authContentCol',
				placement: 'main',
				width: null,
				resizeLimit: [100, 300]
			});
			
			new MUI.Panel({
				header: false,
				id: 'authTreePanel',
				addClass: 'panelAlt',
				contentURL: '/mochaui/data/auth.setter.html',
				column: 'authTreeCol'
			});  
			
			new MUI.Panel({
				header: false,
				id: 'authContentPanel',
				addClass: 'panelAlt',
				contentURL: '/mochaui/data/role.auth.setter.html',
				column: 'authContentCol'
			});   
		}else{
			MUI.notification('<font color=red>错误：</font>只能选择一条记录权限设置！');
			return;
		}
	});
</script>
	